import networkx as nx
import community

from datasets.create_graph import create_graph
from diploma.COBase.diploma_CODEG import diploma_CODEG
from diploma.COBase.diploma_COPR import diploma_COPR
from diploma.COBase.diploma_COPRDD import diploma_COPRDD
from diploma.COBase.diploma_COPRTH import diploma_COPRTH
from diploma.base.diploma_DEG import diploma_DEG
from diploma.base.diploma_PR import diploma_PR
from diploma.base.diploma_PRDD import diploma_PRDD
from diploma.base.diploma_PRTH import diploma_PRTH
from output.create_png import create_png

if __name__ == '__main__':
    # G = create_graph("datasets/email.txt")
    k = 10
    # diploma_DEG(G, k)
    # diploma_PR(G, k)
    # diploma_PRTH(G, k)
    # diploma_PRDD(G, k)
    #
    # partition = community.best_partition(G)
    # # 将节点按照社区划分，存储在一个字典中
    # communities = {}
    # for node, comm_id in partition.items():
    #     if comm_id not in communities:
    #         communities[comm_id] = []
    #     communities[comm_id].append(node)
    #
    # # 将字典转换为列表
    # communities = [list(comm) for comm in communities.values()]
    # communities = sorted(communities, key=len, reverse=True)
    #
    # diploma_CODEG(G, communities, k)
    # diploma_COPR(G, communities, k)
    # diploma_COPRTH(G, communities, k)
    # diploma_COPRDD(G, communities, k)
    create_png(k)
